/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.general.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author lizardo
 */
@Entity
@Table(name = "gen_permiso")
@NamedQueries({@NamedQuery(name = "Permiso.findAll", query = "SELECT p FROM Permiso p"), @NamedQuery(name = "Permiso.findByPmsCodigo", query = "SELECT p FROM Permiso p WHERE p.pmsCodigo = :pmsCodigo"), @NamedQuery(name = "Permiso.findByPmsNombre", query = "SELECT p FROM Permiso p WHERE p.pmsNombre = :pmsNombre"), @NamedQuery(name = "Permiso.findByPmsOrden", query = "SELECT p FROM Permiso p WHERE p.pmsOrden = :pmsOrden"), @NamedQuery(name = "Permiso.findByPmsActivo", query = "SELECT p FROM Permiso p WHERE p.pmsActivo = :pmsActivo")})
public class Permiso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pms_codigo")
    private Integer pmsCodigo;
    @Basic(optional = false)
    @Column(name = "pms_nombre")
    private String pmsNombre;
    @Basic(optional = false)
    @Column(name = "pms_orden")
    private int pmsOrden;
    @Basic(optional = false)
    @Column(name = "pms_activo")
    private boolean pmsActivo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkPmsCodigo", fetch = FetchType.LAZY)
    private List<Acceso> accesoList;

    public Permiso() {
    }

    public Permiso(Integer pmsCodigo) {
        this.pmsCodigo = pmsCodigo;
    }

    public Permiso(Integer pmsCodigo, String pmsNombre, int pmsOrden, boolean pmsActivo) {
        this.pmsCodigo = pmsCodigo;
        this.pmsNombre = pmsNombre;
        this.pmsOrden = pmsOrden;
        this.pmsActivo = pmsActivo;
    }

    public Integer getPmsCodigo() {
        return pmsCodigo;
    }

    public void setPmsCodigo(Integer pmsCodigo) {
        this.pmsCodigo = pmsCodigo;
    }

    public String getPmsNombre() {
        return pmsNombre;
    }

    public void setPmsNombre(String pmsNombre) {
        this.pmsNombre = pmsNombre;
    }

    public int getPmsOrden() {
        return pmsOrden;
    }

    public void setPmsOrden(int pmsOrden) {
        this.pmsOrden = pmsOrden;
    }

    public boolean getPmsActivo() {
        return pmsActivo;
    }

    public void setPmsActivo(boolean pmsActivo) {
        this.pmsActivo = pmsActivo;
    }

    public List<Acceso> getAccesoList() {
        return accesoList;
    }

    public void setAccesoList(List<Acceso> accesoList) {
        this.accesoList = accesoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pmsCodigo != null ? pmsCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Permiso)) {
            return false;
        }
        Permiso other = (Permiso) object;
        if ((this.pmsCodigo == null && other.pmsCodigo != null) || (this.pmsCodigo != null && !this.pmsCodigo.equals(other.pmsCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.general.be.Permiso[pmsCodigo=" + pmsCodigo + "]";
    }

}
